<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>组件注册</title>
    <script src="../vue.global.js"></script>
    <style>
        .red{
            color:red;
        }
        .font-big{
            font-size: 50px;
        }
    </style>
</head>
<body>

<div id="App">

    <button-counter></button-counter>
    <button-counter></button-counter>
    <button-counter></button-counter>

</div>


<script>

    //组件全局注册
    //Vue.createApp().component("button-counter",{}).mounted("#app")

    const buttonCounter = {//子组件
        data(){  //数据
            return {
                counter:666
            }
        },
        //模板
        template:`
                {{counter}}
                <button v-on:click="counter++">Counter++</button><br/>
                `
    };

    const vm = Vue.createApp({  //根组件

        data(){
            return {

            }
        },
        components:{
            'button-counter':buttonCounter,//子组件
            'button-counter2':{}
        }
    });
    vm.mount("#App");


</script>
</body>
</html>